package com.chen.sample1.web.controller;

import com.chen.sample1.common.message.ResponseMsg;
import com.chen.sample1.web.aspect.NotLogParam;
import com.chen.sample1.web.service.ITestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc
 */
@RestController
@RequestMapping("/test")
public class TestController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ITestService testService;

    @NotLogParam
    @GetMapping("/hello")
    public ResponseMsg hello() {
        ResponseMsg responseMsg = testService.hello();
        return responseMsg;
    }

    @GetMapping("/word")
    public ResponseMsg word(String word) {
        logger.info("word:{}", word);
        ResponseMsg responseMsg = testService.word(word);
        return responseMsg;
    }

    @NotLogParam
    @GetMapping("/cacheList")
    public ResponseMsg cacheList(){
        return  testService.localCache();
    }

}
